<?php
include "../inc/config.php";

function random($len)
{
    $srcstr="23456789ABCDEFGHJKLMNPRSTWXY";
    mt_srand();
    $strs="";
    for($i=0;$i<$len;$i++)
	{
        $strs.=$srcstr[mt_rand(0,27)];
    }
    return ($strs);
}

$str=random(4);
setcookie("VerifyId", md5("verifyid_" . $str), time() + 1200, "/", config("domain.root"));

$width = 50;
$height = 25;

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type:image/png");

$im=imagecreate($width,$height);
$back=ImageColorAllocate($im, 255,255,255);     //背景色
$pix=imagecolorallocate($im,187,190,247);        //模糊点颜色
$font = ImageColorAllocate($im, 220,60,190);       //粉红色 字体
//绘模糊作用的点
mt_srand();
for($i=0;$i<100;$i++)
{
     $randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
	imagesetpixel($im,mt_rand(0,$width),mt_rand(0,$height), $randcolor);
}
imagestring($im, 5, 7, 5,$str, $font);
imagefill($im,68,30,$font);
//imagerectangle($im,0,0,$width-1,$height-1,$font);
imagepng($im);
imagedestroy($im);
?>
